<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page isELIgnored="false" %>
<%@ page import="com.lilicould.entity.Account" %>
<html>
<head>
    <title>首页</title>
</head>
<body>

<%
    // 检查 session 中是否有 account 对象
    Object accountObj = session.getAttribute("account");
    if (accountObj != null) {
        Account account = (Account) accountObj;
        String accountType = account.getAccountType();

        if ("tenant".equals(accountType)) {
            // 如果是租客，转发到租客界面
%>
            <jsp:forward page="/page/tenant/index.jsp"/>
<%
        } else if ("employee".equals(accountType)) {
            // 如果是员工，转发到员工界面
            request.getRequestDispatcher("/employee/personalInfo").forward(request, response);
        }else if ("admin".equals(accountType)){
            request.getRequestDispatcher("/employee/info").forward(request, response);
        }
    } else {
%>
            <p>请先<a href="${pageContext.request.contextPath}/login.jsp">登录</a></p>
<%
    }
%>

</body>
</html>
